import Vue from 'vue'
import Vuex from 'vuex'
import * as actions from './actions'
// import * as getters from './getters'
import {
  // eslint-disable-next-line no-unused-vars
  Http
} from '@/api/api'
import {
  // eslint-disable-next-line no-unused-vars
  znk
} from '@/util/public'
Vue.use(Vuex)

// 应用初始状态
const state = {
  // path: 'http://10.21.80.4:1234',
  path: 'http://10.21.81.205:1234',
  that: {},
  userinfo: null,
  limit: 10,
  pageSizes: [10, 50, 100, 200, 300],
  loading: true,
  dict: [],
  pro: '',
  city: '',
  dictState: false,
  country: ''
}
// 定义所需的 mutations
const mutations = {
  PRO (state, data) {
    state.pro = data
  },
  CITY (state, data) {
    state.city = data
  },
  COUNTRY (state, data) {
    state.country = data
  },
  DICT (state, data) {
    state.dict = data
  },
  THAT (state, data) {
    state.that = data
  },
  LOADING (state, data) {
    if (data) {
      state.loading = true
    } else {
      state.loading = false
    }
  },
  LIMIT (state, data) {
    state.limit = data
  },
  USERINFO (state, data) {
    state.userinfo = data
  },
  DICTSTATE (state, data) {
    state.dictState = data
  }
}
// 创建 store 实例
export default new Vuex.Store({
  actions,
  // getters,
  state,
  mutations
})
